﻿using delete.Event;
using Prism.Commands;
using Prism.Events;
using Prism.Mvvm;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace delete.ViewModels
{
    public class ViewAViewModel:BindableBase
    {
        public ViewAViewModel(IEventAggregator eventAggregator)
        {
            this.eventAggregator = eventAggregator;
        }
        private DelegateCommand<string> _updateTextCommand;
        private readonly IEventAggregator eventAggregator;

        public DelegateCommand<string> UpdateTextCommand =>
            _updateTextCommand ?? (_updateTextCommand = new DelegateCommand<string>(ExecuteUpdateTextCommand));

        void ExecuteUpdateTextCommand(string s)
        {
            eventAggregator.GetEvent<EventA>().Publish(s);
        }
    }
}
